<!doctype html>
<html>
<meta charset="utf-8"/>
<title>花集网</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="fav.ico" rel="shortcut icon"/>
<link rel="stylesheet" href="<?php echo JD_PUBLIC_URL; ?>/css/common.css" />
<link rel="stylesheet" href="<?php echo JD_PUBLIC_URL; ?>/css/jquery_ui/jquery.ui.custom.css" />
<script language="JavaScript" src="<?php echo JD_PUBLIC_URL; ?>/js/ajax.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/jquery.ui.min.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/list.js"></script>
<script type="text/javascript" src="<?php echo JD_PUBLIC_URL; ?>/js/floatnav.js"></script>
<script language="JavaScript" src="<?php echo JD_PUBLIC_URL; ?>/js/calendar.js"></script>
</head>
<body>
<div class="container" id="page">
  <div class="navigation">
    <div class="crumbs"> <a href="http://www.huaji.com/index.php/app/job" >我的应用</a><span>&gt;</span><a href="<?php echo JD_BASE_URL;?>/main/">花集通</a><span>&gt;</span>京东&nbsp;&nbsp;&nbsp;&nbsp;<b class="countname"><?php echo $taobao_user_nick;?></b>&nbsp;[<a href="/jdong/index.php/callback/logout" title="如果退出不成功请关闭浏览器再打开">退出京东帐号</a>] 
                      <a style="float:right;" href="javascript:;" id="tongbudata">同步数据</a>&nbsp;
    </div> 
  </div>
  <div id="mainmenu" class="flow-steps num4 clearfix">
    <ol>
      <li class="done current-prev"><span class="first">1、选择平台</span></li>
      <li class="current"><span>2、获取数据</span></li>
      <li><span>3、选择派单</span></li>
      <li class="last"><span>4、完成</span></li>
    </ol>
  </div>
  <div id="trade-search-box" class="searchform form">
    <form id="yw0" action="" method="get">
      <div>
	    <span>买家昵称：
			<input type="text" name="buyer_nick" value="<?php if(isset($_GET['buyer_nick']))echo $_GET['buyer_nick']?>" />
        </span>
		<span>创建时间：从&nbsp;
			<input style="width:75px;" id="startDate" type="text" name="startDate" onClick="calendar(this)" value="<?php if(isset($_GET['startDate']))echo $_GET['startDate']?>" /> 
                <select name="startHour">
                <option value="00" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='00')echo "selected";?>>00</option>
                <option value="01" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='01')echo "selected";?>>01</option>
                <option value="02" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='02')echo "selected";?>>02</option>
                <option value="03" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='03')echo "selected";?>>03</option>
                <option value="04" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='04')echo "selected";?>>04</option>
                <option value="05" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='05')echo "selected";?>>05</option>
                <option value="06" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='06')echo "selected";?>>06</option>
                <option value="07" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='07')echo "selected";?>>07</option>
                <option value="08" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='08')echo "selected";?>>08</option>
                <option value="09" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='09')echo "selected";?>>09</option>
                <option value="10" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='10')echo "selected";?>>10</option>
                <option value="11" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='11')echo "selected";?>>11</option>
                <option value="12" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='12')echo "selected";?>>12</option>
                <option value="13" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='13')echo "selected";?>>13</option>
                <option value="14" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='14')echo "selected";?>>14</option>
                <option value="15" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='15')echo "selected";?>>15</option>
                <option value="16" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='16')echo "selected";?>>16</option>
                <option value="17" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='17')echo "selected";?>>17</option>
                <option value="18" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='18')echo "selected";?>>18</option>
                <option value="19" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='19')echo "selected";?>>19</option>
                <option value="20" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='20')echo "selected";?>>20</option>
                <option value="21" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='21')echo "selected";?>>21</option>
                <option value="22" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='22')echo "selected";?>>22</option>
                <option value="23" <?php if(isset($_GET['startHour']) && $_GET['startHour']=='23')echo "selected";?>>23</option>
                </select>
                :
                <select name="startMinute">
                <option value="00" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='00')echo "selected";?>>00</option>
                <option value="05" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='05')echo "selected";?>>05</option>
                <option value="10" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='10')echo "selected";?>>10</option>
                <option value="15" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='15')echo "selected";?>>15</option>
                <option value="20" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='20')echo "selected";?>>20</option>
                <option value="25" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='25')echo "selected";?>>25</option>
                <option value="30" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='30')echo "selected";?>>30</option>
                <option value="35" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='35')echo "selected";?>>35</option>
                <option value="40" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='40')echo "selected";?>>40</option>
                <option value="45" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='45')echo "selected";?>>45</option>
                <option value="50" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='50')echo "selected";?>>50</option>
                <option value="55" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='55')echo "selected";?>>55</option>
                <option value="59" <?php if(isset($_GET['startMinute']) && $_GET['startMinute']=='59')echo "selected";?>>59</option>
                </select>
                分&nbsp;到&nbsp;<input style="width:75px;" id="endDate" type="text" name="endDate" onClick="calendar(this)" value="<?php if(isset($_GET['endDate']))echo $_GET['endDate']?>" />
                 
                        <select name="endHour">
                <option value="00" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='00')echo "selected";?>>00</option>
                <option value="01" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='01')echo "selected";?>>01</option>
                <option value="02" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='02')echo "selected";?>>02</option>
                <option value="03" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='03')echo "selected";?>>03</option>
                <option value="04" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='04')echo "selected";?>>04</option>
                <option value="05" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='05')echo "selected";?>>05</option>
                <option value="06" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='06')echo "selected";?>>06</option>
                <option value="07" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='07')echo "selected";?>>07</option>
                <option value="08" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='08')echo "selected";?>>08</option>
                <option value="09" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='09')echo "selected";?>>09</option>
                <option value="10" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='10')echo "selected";?>>10</option>
                <option value="11" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='11')echo "selected";?>>11</option>
                <option value="12" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='12')echo "selected";?>>12</option>
                <option value="13" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='13')echo "selected";?>>13</option>
                <option value="14" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='14')echo "selected";?>>14</option>
                <option value="15" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='15')echo "selected";?>>15</option>
                <option value="16" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='16')echo "selected";?>>16</option>
                <option value="17" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='17')echo "selected";?>>17</option>
                <option value="18" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='18')echo "selected";?>>18</option>
                <option value="19" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='19')echo "selected";?>>19</option>
                <option value="20" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='20')echo "selected";?>>20</option>
                <option value="21" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='21')echo "selected";?>>21</option>
                <option value="22" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='22')echo "selected";?>>22</option>
                <option value="23" <?php if(isset($_GET['endHour']) && $_GET['endHour']=='23')echo "selected";?>>23</option>
                </select>
                :
                <select name="endMinute">
                <option value="00" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='00')echo "selected";?>>00</option>
                <option value="05" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='05')echo "selected";?>>05</option>
                <option value="10" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='10')echo "selected";?>>10</option>
                <option value="15" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='15')echo "selected";?>>15</option>
                <option value="20" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='20')echo "selected";?>>20</option>
                <option value="25" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='25')echo "selected";?>>25</option>
                <option value="30" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='30')echo "selected";?>>30</option>
                <option value="35" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='35')echo "selected";?>>35</option>
                <option value="40" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='40')echo "selected";?>>40</option>
                <option value="45" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='45')echo "selected";?>>45</option>
                <option value="50" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='50')echo "selected";?>>50</option>
                <option value="55" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='55')echo "selected";?>>55</option>
                <option value="59" <?php if(isset($_GET['endMinute']) && $_GET['endMinute']=='59')echo "selected";?>>59</option>
                </select>
		</span>
	  </div>
      <div>
		<span>订单编号：
			<input type="text" name="tid" id="tid" value="<?php if(isset($_GET['tid']))echo $_GET['tid']?>" />
        </span>
		<span>订单状态：
			<select name="status">
			  <option value="0" <?php if (empty($status)) echo "selected"; ?> >全部</option>			 
			  <option value="1" <?php if ($status == 1) echo "selected"; ?> >等待出库</option>
              <option value="2" <?php if ($status == 2) echo "selected"; ?> >已出库</option>
			  <option value="3" <?php if ($status == 3) echo "selected"; ?> >买家收货</option>                    
              <option value="4" <?php if ($status == 4) echo "selected"; ?> >取消的订单</option> 
              <option value="5" <?php if ($status == 5) echo "selected"; ?> >锁定的订单</option>         
			</select>
        </span>
          <span>旗帜：
			<select name="id_remark">
			  <option value="0" <?php if (isset($_GET['id_remark']) && empty($_GET['id_remark'])) echo "selected"; ?> >全部</option>			 
			  <option value="1" <?php if (isset($_GET['id_remark']) &&$_GET['id_remark'] == 1) echo "selected"; ?> >红色</option>
                          <option value="2" <?php if (isset($_GET['id_remark']) &&$_GET['id_remark'] == 2) echo "selected"; ?> >橙色</option>
			  <option value="3" <?php if (isset($_GET['id_remark']) &&$_GET['id_remark'] == 3) echo "selected"; ?> >绿色</option>                    
                          <option value="4" <?php if (isset($_GET['id_remark']) &&$_GET['id_remark'] == 4) echo "selected"; ?> >蓝色</option> 
                          <option value="5" <?php if (isset($_GET['id_remark']) &&$_GET['id_remark'] == 5) echo "selected"; ?> >紫色</option>         
			</select>
        </span>
	  </div>
      <div class="search-export">
        <input type="submit" name="btnUpdatetaobao" value="提交更新">
      </div>
    </form>
  </div>
  <!-- search-form -->
  
  <div class="item-list-hd">
    <ul class="item-list-tabs item-list-tabs-flexible clearfix">
      <li <?php if (empty($status)) echo "class='current'"; ?> ><a href="<?php echo JD_SERVICE_URL;?>">所有订单</a></li>    
      <li <?php if ($status == 1) echo "class='current'"; ?> ><a href="<?php echo JD_SERVICE_URL.'/?status=1';?>">等待出库</a></li>
      <li <?php if ($status == 2) echo "class='current'"; ?> ><a href="<?php echo JD_SERVICE_URL.'/?status=2';?>">已出库</a></li> 
      <li <?php if ($status == 3) echo "class='current'"; ?> ><a href="<?php echo JD_SERVICE_URL.'/?status=3';?>">买家已收货</a></li>
      <li <?php if ($status == 4) echo "class='current'"; ?> ><a href="<?php echo JD_SERVICE_URL.'/?status=4';?>">已取消</a></li> 
      <li <?php if ($status == 5) echo "class='current'"; ?> ><a href="<?php echo JD_SERVICE_URL.'/?status=5';?>">锁定订单</a></li>                    
    </ul>
  </div>
  <div class="item-list-bd">
	<div class="filter">
		<span>
	
        <b id="sending"></b></span>
       
		<span class="right"><a href="<?php echo JD_SERVICE_URL.'/?pd=2';?>">未派单</a> | <a href="<?php echo JD_SERVICE_URL.'/?pd=1';?>">已派单</a></span>
	</div>
    <div class="listView">
      <div id="yw1" class="list-view">
        <div class="items">
        
          
         <?php  foreach($data as $d){
		 
		 ?>
                
         <div class="tradeView">
            <div class="tradeViewHead"> 
            <span class="memo-info"><a href="#" class="memo-flag meno_" data-orderid=""></a></span>
          
		   	<?php if(empty($d->hj_no))
		   		echo '<span style="float:right;text-align:center;margin-right:20px;" id="can_id_'.$d->order_id.'" ><a href="'.JD_BASE_URL.'/paidang/?tid='.$d->order_id.'" target="_blank">生成花集订单</a></span> ';
			else
				echo '<span style="float:right;text-align:center;margin-right:20px;" id="can_id_'.$d->order_id.'"><b>花集订单：</b><a href="http://www.huaji.com/member/order/view/'.$d->hj_no.'/1" target="_blank" >'.$d->hj_no.'</a>&nbsp; &nbsp;<b>下单价:</b>'.$d->hj_price.'&nbsp; &nbsp;<b>接单店：</b>'.$d->hj_shop_name.'  &nbsp; &nbsp;<a href="javascript:if(confirm(\'确认要取消派单么？\')) celcan('.$d->order_id.')">取消</a></span>';
			?>
        
             <span> 订单编号：<a href="http://order.shop.jd.com/order/order_orderInfoPage.action?orderId=<?php echo $d->order_id;?>" target="_blank"><?php echo $d->order_id;?></a></span>  
                          
			 <span>下单时间：<?php echo $d->order_start_time;?></span> </div>
            
            <div class="tradeOrder">
              <table>
                <tr>
                  <td width="380" class="goods">
				    <table width="100%">
                     <?php foreach($d->order_info as $info){ ?>
                     <tr class="item">
                        <td width="50"><a target="_blank" href="http://item.jd.com/<?php echo $info->sku_id;?>.html"><img width="50px" height="50px" src="<?php if($info->sku_image){echo $info->sku_image;}else{ echo JD_PUBLIC_URL.'/images/empty.jpg';} ?>" ></a></td>
                        <td width="200"><a target="_blank" href="http://item.jd.com/<?php echo $info->sku_id;?>.html"><?php echo $info->sku_name;?></a></td>
                         
                        <td width="140">订单金额：<span ><?php echo $info->jd_price;?></span> 元</br>
                          数&nbsp;&nbsp;&nbsp;量：<?php echo $info->item_total;?></br>
                        </td>
                    </tr>                   
                    <?php } ?> 
                    </table>
                   </td>
                   <td width="68" class="buyer"><span class="price"><?php echo $d->order_payment ;?></span> 元</td>
                  <td width="90" class="buyer"> 买家信息：<?php echo $d->pin;?> </td>
                  
                  <td width="210" class="addr">收货人信息：<?php echo $d->full_address;?>  <?php echo $d->fullname;?>  </td>
                  <td class="actions">当前状态： 
                  <span  style="color:<?php echo $d->order_state['color'];?>;">
				    <?php echo $d->order_state['text'];?>                </span>
                <br/>
                    派单状态： <?php if( $d->hj_no) echo '已派'; else echo '未派' ;?> <br />
                    <?php if( $d->hj_no && $d->order_state['text'] == '等待出库') echo '<b>&gt;&gt;<a href="javascript:void(0);" order_id="'.$d->order_id.'" hj_no="'.$d->hj_no.'" onclick="return outsop(this)">京东出库</a></b>' ;?> <br /></td>
                </tr>
                <tr>
                    <td colspan="3" style="border-top: 1px solid #ddd;border-right: 1px solid #ddd;">
                        <b>买家留言：</b> <?php echo $d->order_remark;?>                    </td>
                    <td colspan="2" style="border-top: 1px solid #ddd;">
                        <b>卖家备注：</b> <span class="memo-flag meno_<?php echo $d->id_remark;?>"></span><?php echo $d->vender_remark;?></td>
                </tr>
              </table>
            </div>
          </div>
                
			<?php } ?>	
		
		</div>
        <div class="pagination" id="page5">
            <?php echo $page;?>
        </div>
      </div>
    </div>
  </div>
  <div class="clear"></div>
</div>

<div style="display:none;">
    <div id="J_TONGBU_DATA" title="下载京东订单"  style="background-color:#FFF;">
        <form id="tbdform" action="syncdata.php">
            <label>京东订单(仅待出库):</label>
                    <select name="days">
                        <option value="0">当天</option>
                        <option value="3" selected="selected">最近3天</option>
                        <option value="7">最近7天</option>
                        <option value="30">最近30天</option>
             </select>
         </form>
    </div>
</div>
<script type="text/javascript">
function celcan(order_id)
{
     
	$.ajax({   
		   type:"post",   
		   data: "order_id="+order_id+"&r ="+ Math.random(), 
		   url:"<?php echo JD_BASE_URL;?>/paidang/orderCanel/",   
		   success: function(data){ 
			  if(data)
			  {
			     var text ='<a href="<?php echo JD_BASE_URL;?>/paidang/?tid='+order_id+'">生成花集订单</a>';
			     $("#can_id_"+order_id).html(text);
			  }
			  else
			  {
			     alert('操作失败');
			  }
	  }});
	
}

$("#J_TONGBU_DATA").dialog({
        autoOpen: false,
        modal: true,
        width: 300,
        buttons: {
            取消: function() {
                $(this).dialog("close");
            },
            确定: function() {
                syncJD();
                $(this).dialog("close");
            }
        }
});

$("#tongbudata").click(function() {
    $("#J_TONGBU_DATA").dialog("open");
    return false;
});
function syncJD(){
     formd = $("#tbdform").serialize();
    
    if (confirm("确定要同步数据吗？"))
    {
        $.ajax({
            url:"<?php echo JD_BASE_URL;?>/main/getOrders",
            data:formd,
            dataType:"json",
            success:function(html){
                if(html.error == 0){
                    alert("导入"+html.num+"条记录,需要一段时间同步处理，请稍等！");
                }else{
                    alert(html.msg);
                }
            }
        });
    }
}
function outsop(obj){
    $obj = $(obj);
    $.ajax({
        url:"<?php echo JD_BASE_URL;?>/main/outStorage",
        data:{"order_id":$obj.attr("order_id"),"hj_no":$obj.attr("hj_no")},
        success:function(data){
            $obj.remove();
        }
    });
}
</script>
</body>
</html>